<style>
.property-slider #property-images img {
  max-height:450px;
}
.property-slider #property-thumbs img {
  cursor: pointer;
  max-height: 112px;
  opacity: 0.7;

  min-height: 112px;
}
</style>
  <!-- Site Showcase -->
  <div class="site-showcase"> 
    <!-- Start Google Map -->
    <div class="clearfix map-single-page" id="gmap"></div>
    <!-- End Google Map --> 
  </div>
  <!-- Start Content -->
  <div class="main" role="main">
    <div id="content" class="content full">
      <div class="container">
        <div class="row">
          <div class="col-md-9">
          <?php $this->set('title_for_layout',h($property['Property']['title'].'-'.$property['City']['title'])); ?>
            <div class="single-property">
              <h2 class="page-title"><?php echo h($property['Property']['title']); ?> <span class="location"><?php if(isset($property['City']['title'])) echo h($property['City']['title']); ?></span></h2>
              
              <h4><span><?php  if(isset($property['PropertyType']['title'])) echo h($property['PropertyType']['title']);   if(isset($property['Property']['contract_type'])) echo Inflector::humanize(' For '.$property['Property']['contract_type']); ?></span></h4>
              
              
              <div class="price"><strong><?php if(isset($websiteSettings['currency_symbol'])) echo __($websiteSettings['currency_symbol']); ?></strong><span><?php echo number_format($property['Property']['price']); ?></span></div>
              <div class="property-amenities clearfix"> <span class="area"><strong><?php echo __('For'); ?></strong> <?php echo __('Rent'); ?></span> <span class="area"><strong><?php echo h($property['Property']['area']); ?></strong>  <?php echo __('Area'); ?></span> <span class="baths"><strong><?php echo h($property['Property']['baths']); ?> </strong> <?php echo __('Baths'); ?></span> <span class="beds"><strong><?php echo h($property['Property']['beds']); ?></strong>   <?php echo __('Beds'); ?></span> <span class="parking"><strong><?php echo h($property['Property']['parking']); ?></strong>  <?php echo __('Parking'); ?></span> </div>
              <div class="property-slider">
                <div id="property-images" class="flexslider">
                  <ul class="slides">
		  <?php if(isset($property['Property']['image1']) and !empty($property['Property']['image1'])) 
          echo '<li class="item">'.$this->Html->image('/files/property/'.$property['Property']['image1'],array('alt'=>$property['Property']['title'])).'</li>';?>
		  <?php if(isset($property['Property']['image2']) and !empty($property['Property']['image2'])) 
          echo '<li class="item">'.$this->Html->image('/files/property/'.$property['Property']['image2'],array('alt'=>$property['Property']['title'])).'</li>';?>
		  <?php if(isset($property['Property']['image3']) and !empty($property['Property']['image3'])) 
          echo '<li class="item">'.$this->Html->image('/files/property/'.$property['Property']['image3'],array('alt'=>$property['Property']['title'])).'</li>';?>

                  </ul>
                </div>
                <div id="property-thumbs" class="flexslider">
                  <ul class="slides">
		  <?php if(isset($property['Property']['image1']) and !empty($property['Property']['image1'])) 
          echo '<li class="item">'.$this->Html->image('/files/property/thumb/'.$property['Property']['image1'],array('alt'=>$property['Property']['title'])).'</li>';?>
		  <?php if(isset($property['Property']['image2']) and !empty($property['Property']['image2'])) 
          echo '<li class="item">'.$this->Html->image('/files/property/thumb/'.$property['Property']['image2'],array('alt'=>$property['Property']['title'])).'</li>';?>
		  <?php if(isset($property['Property']['image3']) and !empty($property['Property']['image3'])) 
          echo '<li class="item">'.$this->Html->image('/files/property/thumb/'.$property['Property']['image3'],array('alt'=>$property['Property']['title'])).'</li>';?>
                  </ul>
                </div>
              </div>
              <div class="tabs">
                <ul class="nav nav-tabs">
                  <li class="active"> <a data-toggle="tab" href="#description"> <?php echo __('Description'); ?> </a> </li>
                  <li> <a data-toggle="tab" href="#amenities">  <?php echo __('Additional Amenities'); ?> </a> </li>
                </ul>
                <div class="tab-content">
                  <div id="description" class="tab-pane active">
                   <?php echo $this->Text->autoParagraph(h($property['Property']['description'])); ?>
                  </div>
                  <div id="amenities" class="tab-pane">
                    	<div class="additional-amenities">
                    	 <?php if($property['Property']['air_conditioning']) $class='available'; else $class= 'navailable';?>
                         <span class="<?php echo $class;?>"><i class="fa fa-check-square"></i> <?php echo __('Air Conditioning'); ?></span>

                    	 <?php if($property['Property']['heating']) $class='available'; else $class= 'navailable';?>
                         <span class="<?php echo $class;?>"><i class="fa fa-check-square"></i> <?php echo __('Heating'); ?></span>
                         
                    	 <?php if($property['Property']['balcony']) $class='available'; else $class= 'navailable';?>
                         <span class="<?php echo $class;?>"><i class="fa fa-check-square"></i> <?php echo __('Balcony'); ?></span>
                        
                    	 <?php if($property['Property']['dishwasher']) $class='available'; else $class= 'navailable';?>
                         <span class="<?php echo $class;?>"><i class="fa fa-check-square"></i> <?php echo __('Dishwasher'); ?></span>
                        
                    	 <?php if($property['Property']['pool']) $class='available'; else $class= 'navailable';?>
                         <span class="<?php echo $class;?>"><i class="fa fa-check-square"></i> <?php echo __('Pool'); ?></span>
                        
                    	 <?php if($property['Property']['internet']) $class='available'; else $class= 'navailable';?>
                         <span class="<?php echo $class;?>"><i class="fa fa-check-square"></i> <?php echo __('Internet'); ?></span>
                        
                    	 <?php if($property['Property']['terrace']) $class='available'; else $class= 'navailable';?>
                         <span class="<?php echo $class;?>"><i class="fa fa-check-square"></i> <?php echo __('Terrace'); ?></span>
                        
                    	 <?php if($property['Property']['microwave']) $class='available'; else $class= 'navailable';?>
                         <span class="<?php echo $class;?>"><i class="fa fa-check-square"></i> <?php echo __('Microwave'); ?></span>
                        
                    	 <?php if($property['Property']['fridge']) $class='available'; else $class= 'navailable';?>
                         <span class="<?php echo $class;?>"><i class="fa fa-check-square"></i> <?php echo __('Fridge'); ?></span>
                        
                    	 <?php if($property['Property']['cable_tv']) $class='available'; else $class= 'navailable';?>
                         <span class="<?php echo $class;?>"><i class="fa fa-check-square"></i> <?php echo __('Cable TV'); ?></span>
                        
                    	 <?php if($property['Property']['security_camera']) $class='available'; else $class= 'navailable';?>
                         <span class="<?php echo $class;?>"><i class="fa fa-check-square"></i> <?php echo __('Security Camera'); ?></span>
                        
                    	 <?php if($property['Property']['toaster']) $class='available'; else $class= 'navailable';?>
                         <span class="<?php echo $class;?>"><i class="fa fa-check-square"></i> <?php echo __('Toaster'); ?></span>
                        
                    	 <?php if($property['Property']['grill']) $class='available'; else $class= 'navailable';?>
                         <span class="<?php echo $class;?>"><i class="fa fa-check-square"></i> <?php echo __('Grill'); ?></span>
                        
                    	 <?php if($property['Property']['oven']) $class='available'; else $class= 'navailable';?>
                         <span class="<?php echo $class;?>"><i class="fa fa-check-square"></i> <?php echo __('Oven'); ?></span>
                        
                    	 <?php if($property['Property']['fans']) $class='available'; else $class= 'navailable';?>
                         <span class="<?php echo $class;?>"><i class="fa fa-check-square"></i> <?php echo __('Fans'); ?></span>
                     	</div>
                  </div>
                </div>
              </div>
              <?php if(isset($property['User']['id'])){ ?>
              <h3><?php echo __('Agent');?></h3>
              <div class="agent">
              		<div class="row">
						<?php 
						if($property['User']['image'])
						$image	=	'/files/user/'.$property['User']['image'];
						else
						$image	=	'http://placehold.it/600x400&text=IMAGE+COMMING+SOON';
						 ?>
                    	<div class="col-md-4"><?php echo $this->Html->image($image,array('alt'=>'Agent')); ?>
                     	</div>
                    	<div class="col-md-8">
                      	<h4><a href="<?php echo $this->Html->url(array('controller'=>'users','action'=>'agent_detail',$property['User']['id'],Inflector::slug(strtolower($property['User']['first_name'].' '.$property['User']['last_name']),'-'))) ?>"><?php echo h($property['User']['first_name'].' '.$property['User']['last_name']); ?></a></h4>
                         <p><?php //echo ($property['User']['description']);
						  echo h($this->Text->truncate($property['User']['description'],220));?>.</p>
                          <?php //echo $this->Text->autoParagraph(h($property['User']['description'])); ?>
                          <div class="agent-contacts clearfix">
                          	<a href="<?php echo $this->Html->url(array('controller'=>'users','action'=>'agent_detail',$property['User']['id'],Inflector::slug(strtolower($property['User']['first_name'].' '.$property['User']['last_name']),'-'))) ?>" class="btn btn-primary pull-right btn-sm"><?php echo __('Contact Agent'); ?></a>
                           	<ul>
                        <li><a target="_blank" href="<?php echo $this->Html->fix_url($property['User']['facebook']); ?>"><i class="fa fa-facebook"></i></a></li>
                        <li><a target="_blank" href="<?php echo $this->Html->fix_url($property['User']['twitter']); ?>"><i class="fa fa-twitter"></i></a></li>
                        <li><a target="_blank" href="<?php echo $this->Html->fix_url($property['User']['google_plus']); ?>"><i class="fa fa-google-plus"></i></a></li>
                        <li><a target="_blank" href="<?php echo $this->Html->fix_url($property['User']['linkedin']); ?>"><i class="fa fa-linkedin"></i></a></li>
                         		</ul>
                          </div>
                      </div>
                  </div>
              </div>
              <?php } ?>
            </div>
            <!-- Start Related Properties -->
            <h3><?php echo __('Related Properties'); ?></h3>
            <div class="property-grid">
              <ul class="grid-holder col-3">
				<?php foreach ($properties as $property): ?>
                <li class="grid-item type-rent">
                  <div class="property-block"> <a href="<?php echo $this->Html->url(array('action'=>'view',$property['Property']['id'],Inflector::slug(strtolower($property['Property']['title']),'-'))); ?>" class="property-featured-image">  <?php echo $this->Html->image('/files/property/thumb/'.$property['Property']['image1'],array('alt'=>$property['Property']['title'])); ?> <span class="images-count"><i class="fa fa-picture-o"></i> 2</span> <span class="badges"><?php if(isset($property['Property']['contract_type'])) echo __(ucwords($property['Property']['contract_type'])); ?></span> </a>
                    <div class="property-info">
                      <h4><?php echo $this->Html->link(__(h($this->Text->truncate($property['Property']['title'],30))),array('action'=>'view',$property['Property']['id'],Inflector::slug(strtolower($property['Property']['title']),'-'))); ?></h4>
                      <!--<span class="location">NYC</span>-->
                      <div class="price"><strong><?php if(isset($websiteSettings['currency_symbol'])) echo __($websiteSettings['currency_symbol']); ?></strong><span><?php if(isset($property['Property']['price'])) echo  number_format($property['Property']['price']); ?></span></div>
                    </div>
                    <div class="property-amenities clearfix"> <span class="area"><strong><?php echo h($property['Property']['area']); ?></strong> <?php echo __('Area'); ?></span> <span class="baths"><strong><?php echo h($property['Property']['baths']); ?></strong> <?php echo __('Baths'); ?></span> <span class="beds"><strong><?php echo h($property['Property']['beds']); ?></strong> <?php echo __('Beds'); ?></span> <span class="parking"><strong><?php echo h($property['Property']['parking']); ?></strong>  <?php echo __('Parking'); ?></span> </div>
                  </div>
                </li>
				<?php endforeach; ?>
              </ul>
            </div>
          </div>
            <!-- Start Sidebar -->
             <div class="sidebar right-sidebar col-md-3">
              <?php echo $this->element('side-bar-property-search-form'); ?>
              <?php echo $this->element('side-bar', array(), array('cache' => array('config' => 'cache'))); ?>
              </div>
              <!-- End Sidebar -->
        </div>
      </div>
    </div>
  </div>
<script src="http://maps.google.com/maps/api/js?sensor=false"></script> <!-- Google Map --> 
<script type="text/javascript">
        function PropertiesMap() {

            /* Properties Array */
            var properties = [
                { title:" <?php echo ($property['Property']['title']) ?>",  price:"<strong><?php if(isset($websiteSettings['currency_symbol'])) echo __($websiteSettings['currency_symbol']); ?></strong><span><?php if(isset($property['Property']['price'])) echo __($property['Property']['price']); ?></span>",  lat:33.678465,  lng:73.0202138,  thumb:"<?php echo $this->Html->url('/files/property/thumb/'.$property['Property']['image1']); ?>",  url:"property-details.html",  icon:"<?php echo $this->Html->url('/images/map-marker.png'); ?>", }
				
				];

            /* Map Center Location - From Theme Options */
            var location_center = new google.maps.LatLng(properties[0].lat,properties[0].lng);

            var mapOptions = {
                zoom: 16,
				center: new google.maps.LatLng(properties[0].lat,properties[0].lng),
				scrollwheel: false
            }

            var map = new google.maps.Map(document.getElementById("gmap"), mapOptions);

            var markers = new Array();
            var info_windows = new Array();

            for (var i=0; i < properties.length; i++) {

                markers[i] = new google.maps.Marker({
                    position: map.getCenter(),
					map: map,
                    icon: properties[i].icon,
                    title: properties[i].title,
                    animation: google.maps.Animation.DROP
                });

                bounds.extend(markers[i].getPosition());

                info_windows[i] = new google.maps.InfoWindow({
                    content:    '<div class="map-property">'+
                        '<h4 class="property-title"><a class="title-link" href="'+properties[i].url+'">'+properties[i].title+'</a></h4>'+
                        '<a class="property-featured-image" href="'+properties[i].url+'"><img class="property-thumb" src="'+properties[i].thumb+'" alt="'+properties[i].title+'"/></a>'+
                        '<p><span class="price">'+properties[i].price+'</span></p>'+
                        '<a class="btn btn-primary btn-sm" href="'+properties[i].url+'">Details</a>'+
                        '</div>'
                });

                attachInfoWindowToMarker(map, markers[i], info_windows[i]);
            }

            map.fitBounds(bounds);

            /* function to attach infowindow with marker */
            function attachInfoWindowToMarker( map, marker, infoWindow ){
                google.maps.event.addListener( marker, 'click', function(){
                    infoWindow.open( map, marker );
                });
            }

        }

        google.maps.event.addDomListener(window, 'load', PropertiesMap);
    </script> 
